package com.lovo.middleman.controller;

import com.lovo.middleman.bean.BuyCarBean;
import com.lovo.middleman.service.IBuyCarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/buyCar")
public class BuyCarController {

    @Autowired
    IBuyCarService iBuyCarService;

    @RequestMapping("/getBuyCarBeanByUserId")
    public List<BuyCarBean> getBuyCarBeanByUserId(int userId){
       return iBuyCarService.queryAllBuyCarBeanByUserId(userId);
    }

    @RequestMapping("/addBuyBean")
    public void addBuyBean(BuyCarBean buyCarBean,int userId){
        iBuyCarService.addBuyCarBean(buyCarBean,userId);
    }

    @RequestMapping("/deleteBuyBeanById")
    public void deleteBuyBeanById(int buyId){
        iBuyCarService.deleteBuyCarBean(buyId);
    }

}
